package com.woniuxy.cloud.ticket52.movieassembly.apiimpl;


import com.woniuxy.cloud.ticket52.ActorAPI;
import com.woniuxy.cloud.ticket52.common.result.Result;
import com.woniuxy.cloud.ticket52.form.ActorAddForm;
import com.woniuxy.cloud.ticket52.movieassembly.model.Actor;
import com.woniuxy.cloud.ticket52.movieassembly.model.Comment;
import com.woniuxy.cloud.ticket52.movieassembly.service.IActorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 演员信息 前端控制器
 * </p>
 *
 * @author rc
 * @since 2021-05-06
 */
@RestController
@Slf4j
public class ActorController implements ActorAPI {

    @Autowired
    private IActorService iActorService;

    @Override
    public Result addactor(ActorAddForm form) {
        log.info("添加演员信息{}",form);
        Actor actor = new Actor();
        BeanUtils.copyProperties(form, actor);
        iActorService.save(actor);
        return Result.success();
    }

    @Override
    public Result getactor(int movie_id) {
        log.info("查询电影{}的演员信息",movie_id);
        Actor actor = iActorService.findByMid(movie_id);
        return Result.success(actor);
    }
}

